<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/aui.css" />
    <link rel="stylesheet" type="text/css" href="../css/style.css" />
    <style>
        body {
            background: #f8f8f8;
        }

        .search {
            margin-right: 0.5rem;
            background: #fd5454;
            font-size: 0.6rem;
            padding: 0.2rem 0.5rem;
            border-radius: 0.2rem;
            color: #ffffff;
        }
    </style>
</head>

<body>
    <div class="vue">
        <div class="message-list">
            <div class="aui-searchbar" id="search" style="margin-bottom:0.5rem;border-radius:0.3rem">
                <div class="aui-searchbar-input aui-border-radius">
                    <i class="aui-iconfont aui-icon-search"></i>
                    <input type="search" placeholder="请输入搜索内容" id="search-input" v-model="keyword">
                </div>
                <span class="search" @click="search">搜索</span>
            </div>
            <div class="loading" v-if="loading"></div>
            <!-- 餐饮 -->
            <div class="aui-card-list" v-for="(item,index) in list" @click="detail(item)" v-if="cate_name=='goods'">
                <div class="aui-card-list-header">
                    <h3>预订通知</h3>
                    <span class="time">{{item.add_time}}</span>
                </div>
                <div class="aui-card-list-content-padded content">
                    {{item.shop_name}} 预订人数<span style="color:#ff2600">{{item.num}}人</span>
                    <div>预订时间：{{item.time}}</div>
                </div>
                <div class="aui-card-list-footer">
                    <span class="name">姓名：{{item.name}}</span>
                    <span class="tel">联系：{{item.iphone}}</span>
                </div>
            </div>

            <!-- 酒店 -->
            <div class="aui-card-list" v-for="(item,index) in list" @click="detail(item)" v-if="cate_name=='hotel'">
                <div class="aui-card-list-header">
                    <h3>预订通知</h3>
                    <span class="time">{{item.create_time}}</span>
                </div>
                <div class="aui-card-list-content-padded content">
                    {{item.shop_name}} 预订房间总数<span style="color:#ff2600">{{item.total_num}}</span>
                    <div>预订入住时间：{{item.startDate}}</div>
                </div>
                <div class="aui-card-list-footer">
                    <span class="name">姓名：{{item.name}}</span>
                    <span class="tel">联系：{{item.phone}}</span>
                </div>
            </div>

            <!-- KTV -->
            <div class="aui-card-list" v-for="(item,index) in list" @click="detail(item)" v-if="cate_name=='KTV'">
                <div class="aui-card-list-header">
                    <h3>预订通知</h3>
                    <span class="time">{{item.create_time}}</span>
                </div>
                <div class="aui-card-list-content-padded content">
                    {{item.shop_name}}
                    <div>预订包厢类型：{{item.room_type}}</div>
                    <div>预订包厢场次时间：{{item.business_hours}}</div>
                    <div>预订消费包厢日期：{{item.dateTime}}</div>
                </div>
                <div class="aui-card-list-footer">
                    <span class="name">姓名：{{item.name}}</span>
                    <span class="tel">联系：{{item.phone}}</span>
                </div>
            </div>

            <!-- 养生 -->
            <div class="aui-card-list" v-for="(item,index) in list" @click="detail(item)" v-if="cate_name=='health'">
                <div class="aui-card-list-header">
                    <h3>预订通知</h3>
                    <span class="time">{{item.create_time}}</span>
                </div>
                <div class="aui-card-list-content-padded content">
                    {{item.shop_name}}
                    <div>预订养生类型：{{item.room_type}}</div>
                    <div>预订到店时间：{{item.startDate}}</div>
                </div>
                <div class="aui-card-list-footer">
                    <span class="name">姓名：{{item.name}}</span>
                    <span class="tel">联系：{{item.phone}}</span>
                </div>
            </div>

            <!-- 景点 -->
            <div class="aui-card-list" v-for="(item,index) in list" @click="detail(item)" v-if="cate_name=='scenic'">
                <div class="aui-card-list-header">
                    <h3>预订通知</h3>
                    <span class="time">{{item.create_time}}</span>
                </div>
                <div class="aui-card-list-content-padded content">
                    {{item.shop_name}}
                    <div>预订景点：{{item.scenic_type}}</div>
                    <div>使用时间：{{item.startDate}}</div>
                </div>
                <div class="aui-card-list-footer">
                    <span class="name">姓名：{{item.name}}</span>
                    <span class="tel">联系：{{item.phone}}</span>
                </div>
            </div>

            <!-- 其他 -->
            <div class="aui-card-list" v-for="(item,index) in list" v-if="cate_name=='other'">
                <div class="aui-card-list-header">
                    <h3>预订通知</h3>
                    <span class="time">{{item.create_time}}</span>
                </div>
                <div class="aui-card-list-content-padded content">
                    {{item.shop_name}}
                    <div>预订商品：{{item.goods_name}}</div>
                    <div>预订时间：{{item.times}}</div>
                </div>
                <div class="aui-card-list-footer">
                    <span class="name">姓名：{{item.name}}</span>
                    <span class="tel">联系：{{item.phone}}</span>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript" src="../script/vue.js"></script>
    <script type="text/javascript" src="../script/base64.js"></script>
    <script type="text/javascript" src="../script/app.js"></script>
    <script type="text/javascript">
        apiready = function() {
            var user = app.getUser();
            api.setRefreshHeaderInfo({
                loadingImg: 'widget://image/refresh.png',
                bgColor: '#f8f8f8',
                textColor: '#505050',
                textDown: '下拉刷新...',
                textUp: '松开刷新...'
            }, function(ret, err) {
                Ve.page = 1
                Ve.getList(function() {
                    Ve.list = []
                    api.refreshHeaderLoadDone();
                })
            });

            api.addEventListener({
                name: 'scrolltobottom',
                extra: {
                    threshold: 15
                }
            }, function(ret, err) {
                Ve.getList()
            });

            var Ve = new Vue({
                el: '.vue',
                data: {
                    loading: true,
                    cate_name: '',
                    page: 1,
                    list: [],
                    keyword: ''
                },
                methods: {
                    getList: function(callback) {
                        app.request.post('/myhome/business_message', {
                            business_id: user.business_id,
                            search_input: this.keyword,
                            page: this.page,
                            signature: app.sign(user.business_id)
                        }, {}, function(res) {
                            // console.log(JSON.stringify(res))
                            callback && callback()
                            if (res.code == 1) {
                                Ve.page++;
                                Ve.cate_name = res.cate_name
                                for (var i in res.data) {
                                    Ve.list.push(res.data[i])
                                }
                            } else {
                                app.error(res.msg);
                            }
                            app.loadingFinish(Ve)
                        })
                    },
                    detail: function(item) {
                        api.openWin({
                            name: 'message_detail',
                            url: 'message_detail.html',
                            pageParam: {
                                cate_name: this.cate_name,
                                message: item
                            }
                        });
                    },
                    search: function() {
                        this.list = []
                        this.page = 1
                        this.getList()
                    }
                },
                created: function() {
                    this.getList()
                }
            })
        }
    </script>
</body>

</html>
